using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace Rapier.Kodachi.Core
{
    [Serializable]
    public class IndexExtension : INotifyPropertyChanged
    {
        private string _Extension;
        public string Extension
        {
            get { return _Extension; }
            set 
            { 
                _Extension = value;
                OnPropertyChanged(new PropertyChangedEventArgs("Extension"));
            }
        }

        public IndexExtension() { }

        public IndexExtension(string extension)
        {
            _Extension = extension;
        }

        public override string ToString()
        {
            return _Extension;
        }

        public override bool Equals(object obj)
        {
            if (obj.GetType() != typeof(IndexExtension))
                return false;

            return Extension.Equals((obj as IndexExtension).Extension);
        }

        public override int GetHashCode()
        {
            return Extension.GetHashCode();
        }

        #region INotifyPropertyChanged Members
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        protected void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, e);
        }
    }
}
